package fons.model.query.fun;

public class FirstFun implements Function {
	public final Function list;
	
	public FirstFun() {
		this.list = null;
	}
	
	public FirstFun(Function list) {
		this.list = list;
	}
	
	@Override
	public Function apply(Function other) {
		if (list == null) return new FirstFun(other);
		return this;
	}

	@Override
	public Function apply() {
		return ((ListFun) list.apply()).get().iterator().next();
	}

}
